package com.zone.mybatis.io;

import java.io.IOException;
import java.io.InputStream;

/**
 * @author: zongzi
 * @description: TODO
 * @date: 2023/12/17
 */
public class Resources {

    public static InputStream getResourceAsStream(String resource) throws IOException {
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        InputStream inputStream = classLoader.getResourceAsStream(resource);
        if (inputStream == null) {
            throw new IOException("unknown resource: " + resource);
        }
        return inputStream;
    }


    public static Class<?> classForName(String className) throws ClassNotFoundException {
        return Class.forName(className);
    }
}
